package com.dayuanit.dy16.ebook.ebookweb.mapper;

import com.dayuanit.dy16.ebook.ebookweb.entity.Commodity;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CommodityMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Commodity record);

    int insertSelective(Commodity record);

    Commodity selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Commodity record);

    int updateByPrimaryKeyWithBLOBs(Commodity record);

    int updateByPrimaryKey(Commodity record);

    List<Commodity> loadByThirdNav(Long navId);

    List<Commodity> listByIds(@Param("commodityIds") List<Long> commodityIds);

    int updateStock(@Param("commodityId") Long commodityId, @Param("buyNum") Integer buyNum, @Param("oldStock") Integer oldStock);

    Commodity getById4Lock(Long commodityId);
}